package spindles.gwt.server.util;

import java.io.Serializable;
import java.security.Principal;

import spindles.api.domain.User;

public class SimplePrincipal implements Principal, Serializable {	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1288440437023920737L;
	
	public static final SimplePrincipal TESTPRINCIPAL = new SimplePrincipal(User.getDefaultUser());
	
	private User user;
	
	public SimplePrincipal(User user){
		this.user = user;
	}

	public String getName() {		
		return user.getUserName();
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	public boolean equals(Object obj) {
		return user.equals(obj);
	}
	
	public int hashCode(){
		return user.hashCode();
	}
	
	public String toString(){
		return user.toString();
	}
}
